// import 'ol/ol.css';
import Map from "ol/Map";
import View from "ol/View";
import { OverviewMap, defaults as defaultControls } from "ol/control";
import LayerManage from "./util/layerManage";
import DrawManage from "./util/drawManage";
import ScreenShot from "./util/screenShot";
import ClusterPoint from "./util/clusterPoint";
import EchartCluster from "./util/echartCluster";

export default class JointOl {
	constructor(id, options) {
		this.map = new Map({
			target: id,
			layers: [],
			view: new View({
				...options,
			}),
			controls: defaultControls({
				zoom: false,
				rotate: false,
				attribution: false,
			}),
		});
		this.#initLayerManage();
		this.#initDrawManage();
		this.#initScreenShot();
		this.#initClusterPoint();
		this.#initEchartCluster();
	}

	addLayer(layer) {
		this.map.setLayers(layer);
	}

	#initLayerManage() {
		this.layerManage = new LayerManage(this.map);
	}

	#initDrawManage() {
		this.drawManage = new DrawManage(this.map);
	}

	#initScreenShot() {
		this.screenShot = new ScreenShot(this.map);
	}

	#initClusterPoint() {
		this.clusterPoint = new ClusterPoint(this.map);
	}

	#initEchartCluster() {
		this.echartCluster = new EchartCluster(this.map);
	}
}
